package whisper.api.gateway.frame.auth.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import whisper.api.gateway.frame.auth.domain.Role;
import whisper.api.gateway.frame.auth.domain.User;
import whisper.api.gateway.frame.auth.repository.UserRepository;

import java.util.List;

/**
 * Created by JT on 2017/9/22.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;


    /**
     * 通过用户名查询用户
     * @param username 用户名
     * @return
     */
    @Override
    public User findUserByUsername(String username) {
        return userRepository.findUserByUsername(username);
    }

    /**
     * 添加用户
     *
     * @param user 用户实体
     */
    @Override
    public void addUser(User user) {
        userRepository.insertUser(user);
    }

    @Override
    public List<Role> findRolesByUid(Integer uid) {
        return null;
    }


}
